package Alog;

import java.util.Scanner;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/10/18 19:23
 */
public class Test3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num1 = scanner.nextInt();
        int num2 = scanner.nextInt();
        System.out.println(findCommonDivisor(num1,num2));
        System.out.println(findCommonMultiple(num1,num2));
    }
    //公约数
    public static int  findCommonDivisor(int num1,int num2){
        int tem=0;
        if(num1 < num2){//使 num1 > num2
            tem = num1;
            num1 = num2;
            num2 =tem;
        }
        while (num2 > 0){
            tem = num1 % num2;
            num1 = num2;
            num2 = tem;
        }
        return num1;
    }
    //最小公倍数Common multiple
    public static int  findCommonMultiple(int num1,int num2){
        for (int i = 2;  ; i++) {
            if(i%num1 == 0 && i%num2 ==0){
                return i;
            }
        }
    }
}
